ATSUI functions that draw, highlight, measure, or otherwise operate on text do so to a range of text, not the entire text buffer (unless you specify the entire buffer - see next paragraph). You specify the beginning of this range with an edge offset of type UniCharArrayOffset, and demarcate the end of the range by indicating a length of type UniCharCount.
If you want the range to span the end of the text buffer, you should pass the constant kATSUToTextEnd. If you want the range to span the entire text buffer (from the beginning), pass kATSUToTextEnd in conjunction with the constant kATSUFromTextBeginning, described in Text Offset Constant.
enum {
kATSUToTextEnd = (long)0xFFFFFFFF
};
Constant descriptions
kATSUToTextEnd
Indicates that the range of text to be operated on should span to the end of the text layout object's text buffer.